Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I try to debug cockroach with VSCode, I found some bugs when I try to set breakpoints.
VSCode tells me that some files cannot be found in dlv sources, even if I use this to substitute the path to package path:
{ "from": "${workspaceFolder}", "to": "github.com/cockroachdb/cockroach" },One of the cases is
/pkg/gossip/gossip.goWhen using
dlvas follows:dlv exec ../_bazel/bin/pkg/cmd/cockroach/cockroach_/cockroach -- start --insecure --store=node1 --listen-addr=localhost:26257 --http-addr=localhost:8080 --join=localhost:26257,localhost:26258,localhost:26259and then use
sourcescommand to list all sources. You can find its path like this:github.com/cockroachdb/cockroach/pkg/gossip/pkg/gossip/gossip.goThe relpath
pkg/gossiphas been appended twice.This problem is associated with one issue in cockroach:
cockroachdb/cockroach#64379
You modified complilepkg.go as follows:
But when you debug bazel, you can get the command passed bazel looks like this:
The first src is the protobuf file and therefore
srcs.goSrcs[0].filenameisbazel-out/k8-dbg/bin/foo/foo_go_proto_/example.com/foo/foo.pb.go, but we are expecting the source file which is not generated.so I modify this part as follows:
Once srcs has source code which is not generated, we use its path.
Then problem is fixed, and we get its path in
dlvas follows:github.com/cockroachdb/cockroach/pkg/gossip/gossip.go